begintownscript;

 begintownscript;	

 variables;
int i,j,k,r1,choice;
body;
beginstate INIT_STATE;

	if (get_flag(100,8) == 0)
		set_flag(100,8,5);

	add_char_to_group(22,1);
	add_char_to_group(23,1);
	add_char_to_group(24,1);

	add_char_to_group(26,2);
	add_char_to_group(25,2);
	add_char_to_group(28,2);

	if (get_flag(1,5) == 0) {
		force_instant_terrain_redraw();
		message_dialog("You have entered the grounds of the Yelbro trade post. Watching it from up close confirms what you could see from afar: it has been destroyed. Parts of its walls are charred as if a fire ball had hit them.","An explosion has torn up the road leading to the front door. The black smoke you saw miles away comes from a great bonfire. The smell of burnt flesh fills your nostrils. Large humanoid shapes move behind the flame. The ogres command the trade post now.");
		set_flag(1,5,1);
}

	if (get_flag(100,4) == 1) {
		activate_hidden_group(1);
		add_char_to_group(9,3);
		add_char_to_group(10,3);
		add_char_to_group(11,3);
		add_char_to_group(12,3);
		add_char_to_group(13,3);
		add_char_to_group(14,3);
		add_char_to_group(15,3);
		add_char_to_group(16,3);
		set_name(9,"Sergeant Parks");
		set_level(9,18);
		force_instant_terrain_redraw();
		reset_dialog();
		add_dialog_str(0,"Your small group of soldiers positions itself near the road. The roaring bonfire is obviously upsetting them. Sergeant Parks gestures you to listen. _The ogres have clearly left a small task force here for looting._",0);
		add_dialog_str(1,"_So I propose that we split up in two groups. I'll be in charge of the first group and we'll move directly forward from the lobby. You'll lead the second group right of the lobby. How does that sound?_",0); 
		add_dialog_choice(0,"Sounds like a plan!");
		add_dialog_choice(1,"No! We stick together!");
		choice = run_dialog(1);

		if (choice == 1) {
			set_flag(100,4,2);
			message_dialog("_It's a thought at least, might not be that smart. If you want to change the plan or simply ask for my opinion about something then don't hesitate for a moment._","The soldiers begin their attack.");
}

		if (choice == 2) {
			message_dialog("Parks simply nods his head. Apparently he has no qualms about handing the command over to you. _As you say. Lead us forward and we'll attack!_","");
			set_flag(100,4,3);
}
}

	set_name(37,"Fang");
	set_level(37,14);
	set_name(38,"Claw");
	set_level(38,14);
	 break;	

beginstate START_STATE;

break;	

beginstate EXIT_STATE;
	if (get_flag(0,5) >= 3) {
		reset_dialog();
		add_dialog_str(0,"You are about to leave the Yelbro trade post. Would you like to return here later?",0);
		add_dialog_choice(0,"Yes. There is yet more to explore.");
		add_dialog_choice(1,"No. I am done here.");
		choice = run_dialog(1);

		if (choice == 2) {
			message_dialog("From now on you can walk right past the Yelbro trade post in the outdoor map.","");
			set_town_visibility(1,0);
}
}
	if ((char_ok(9) == TRUE) && (get_flag(1,7) >= 1))
		set_flag(60,1,1);
break;

beginstate 10;
	if (get_flag(1,3) == 0) {

		reset_dialog();
		add_dialog_str(0,"A swirling clear liquid sparkles at you from the pool. At first you thought it was simply water, but it does not look quite right. The light reflects from it oddly. Whatever it is there is not much of it left in the pool.",0);
		add_dialog_str(1,"Although, perhaps there never was much of it to begin with. It does look strangely appealing, though, like it is commanding you to drink it.",0);
		add_dialog_choice(0,"Leave it alone. Who knows what it is.");
		add_dialog_choice(1,"Drink the liquid.");
		choice = run_dialog(1);

		if (choice == 2) {
			revive_party();
			set_flag(1,3,1);
			set_terrain(11,15,447);
			message_dialog("You bend over and start sipping the liquid. It is indeed terribly refreshing. It is like there is a mountain stream running down your throat. It not only quenches your thirst it also heals your wounds and recovers your energy.","The pool is completely drained.");
}
}

 break;

beginstate 11;
	if (get_flag(1,4) == 0) {
		message_dialog("You found out where the smell of burnt flesh is coming from. Bodies of Empire soldiers and Yelbro merchants have been brought to the fire where they are burned. No, not burned; cooked and eaten.","Some of the bodies have already been half eaten. One of the soldiers is just a torso. The bodies have been stripped naked. You turn away in disgust.");
		set_flag(1,4,1);
}

	if (get_flag(1,7) == 1) {
		set_total_visibility(1);
		force_view_center(19,24);
	force_instant_terrain_redraw();
		pause(3);
		force_view_center(17,25);
	force_instant_terrain_redraw();
		pause(3);
		force_view_center(15,27);
	force_instant_terrain_redraw();
		pause(3);
		force_view_center(13,27);
	force_instant_terrain_redraw();
		pause(5);
		put_boom_on_space(13,27,0,0);
		run_animation_sound(152);
		pause(1);
		activate_hidden_group(5);
	force_instant_terrain_redraw();
		pause(7);
		message_dialog("_Human!_ The shout comes from a heavily armored ogre apparition. Its figure looks pale and it is translucent, but even in this form the ogre is an impressive sight. It extends a massive arm and points a huge greatsword at you. _You great warrior!_","_Killed Lord of the Worgs! That's why we talk! Talk in mountains!_ It grins, points to the mountains in the north-west and abruptly fades away.");
		set_flag(1,7,3);
		force_view_center(char_loc_x(0),char_loc_y(0));
		set_total_visibility(0);
		erase_char(40);
	force_instant_terrain_redraw();
}
 break;

beginstate 12;

	if (get_flag(10,7) == 0) {
		message_dialog("You enter the stables of the trade post. Apparently the Yelbro merchants had some horses at their disposal. They are all gone now. Splattered blood and drag marks are the only things left in their pens.","You would guess that the ogres have butchered and eaten the horses.");
		set_flag(10,7,1);
}

 break;

beginstate 13;
	if ((get_flag(100,4) == 3) && (char_ok(11) == TRUE) && (get_flag(1,6) == 0)) {
		set_flag(1,6,1);
		begin_talk_mode(7);
}
 break;

beginstate 14;
 break;

beginstate 15;
	set_terrain(15,17,14);
	set_terrain(32,15,14);
	set_terrain(28,12,15);

	alert_char(22);
	alert_char(23);
	alert_char(24);
	if (char_ok(27) == TRUE)
		approach_waypoint(27,0,1);

	approach_waypoint(1002,0,1);
 break;

beginstate 16;
	if (get_flag(0,5) == 1) {
		message_dialog("For some reason the ogres have left this corpse untouched. It has been left here, which is most probably the place it fell down. A fire bolt has burned his face and most of his clothing.","However, on his sleeve you can make out his insignia and this was a captain of the Imperial army. Since there were no other captains in Quarhag pass, this must be captain Leppington.");
		set_flag(0,5,3);
		toggle_quest(0,0);
		award_party_xp(55,13);
}
 break;

beginstate 17;
	if (get_flag(1,9) == 0) {
		message_dialog("This must be where the ogres entered the trade post. A section of the wall has been blasted to rubble. Chunks of mortar and gravel of various sizes can be seen all around the room. You also see a few blood stains, but no bodies.","Judging by the blood, someone died here. The ogres must have dragged all the dead to the front of the trade post which must also be the direction the battle progressed to.");
		set_flag(1,9,1);
}
 break;
